home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 3.2 KB | 107 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: PrintHdl.cpp
- // Release Version: $ ODF 1 $
- //
- // Author: Henri Lamiraux
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "ODFDraw.hpp"
-
- #ifndef PRINTHDL_H
- #include "PrintHdl.h"
- #endif
-
- #ifndef DRAWFRM_H
- #include "DrawFrm.h"
- #endif
-
- #ifndef DRAWCONT_H
- #include "DrawCont.h"
- #endif
-
- #ifndef FWPART_H
- #include "FWPart.h"
- #endif
-
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment odfdrawframes
- #endif
-
- //========================================================================================
- // CDrawPrintHandler
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // CDrawPrintHandler::CDrawPrintHandler
- //----------------------------------------------------------------------------------------
- // FALSE means I will be drawing the embedded frames. No need for the printhandler to do it
-
- CDrawPrintHandler::CDrawPrintHandler(Environment* ev, CDrawFrame* frame, CDrawPartContent* content, FW_CPresentation* presentation) :
- FW_CPrintHandler(content->GetPart(ev), frame, FALSE),
- fDrawFrame(frame),
- fPartContent(content),
- fPrintPresentation(presentation)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPrintHandler::~CDrawPrintHandler
- //----------------------------------------------------------------------------------------
-
- CDrawPrintHandler::~CDrawPrintHandler()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPrintHandler::IsCurrentlyPrintable
- //----------------------------------------------------------------------------------------
-
- FW_Boolean CDrawPrintHandler::IsCurrentlyPrintable(Environment* ev) const
- {
- FW_UNUSED(ev);
- return !fPartContent->IsEmpty();
- }
-
- //----------------------------------------------------------------------------------------
- // CDrawPrintHandler::GetPrintContentExtent
- //----------------------------------------------------------------------------------------
-
- void CDrawPrintHandler::GetPrintContentExtent(Environment *ev, FW_CPoint& extent) const
- {
- #ifndef FW_DEBUG
- FW_UNUSED(ev);
- #endif
- // We only enable print command if there is anything to print
- FW_ASSERT(IsCurrentlyPrintable(ev));
-
- // Go through all the shapes and determine their bounds
- extent.Set(FW_kFixed0, FW_kFixed0);
- CDrawContentShapeIterator ite(fPartContent);
- for (CBaseShape* theShape = ite.First(); ite.IsNotComplete(); theShape = ite.Next())
- {
- FW_CRect updateBox;
- theShape->GetUpdateBox(updateBox);
-
- if (updateBox.right > extent.x)
- extent.x = updateBox.right;
-
- if (updateBox.bottom > extent.y)
- extent.y = updateBox.bottom;
- }
-
- FW_ASSERT(extent.x != FW_kFixed0);
- FW_ASSERT(extent.y != FW_kFixed0);
- }
-